﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using AutenticacionFormulario.App_Data;

namespace AutenticacionFormulario
{
    public class Rol
    {
        AutenticacionDataClassesDataContext dc = new AutenticacionDataClassesDataContext();
        const char SI = 'S';
        internal void AddRole (string description)
        {
            ROLE role = new ROLE();
            role.DESCRIPCION = description;
            dc.ROLE.InsertOnSubmit(role);
            dc.SubmitChanges();
        }

        internal ROLE FindRol(Guid? codigoRole)
        {
            var roles = from u in dc.ROLE
                      where u.ID_ROLE == codigoRole
                      select u;
            if (roles.Count() > 0)
                return roles.First();
            else
                return null;

        }
    }
}